<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="theme-color" content="#33474d">
	<title>Mysql-5.5+Heartbeat-3.0.5+DRBD | 失落的乐章</title>
	<link rel="stylesheet" href="/css/style.css" />
	
      <link rel="alternate" href="/atom.xml" title="失落的乐章" type="application/atom+xml">
    
</head>

<body>

	<header class="header">
		<nav class="header__nav">
			
				<a href="/archives" class="header__link">Archive</a>
			
				<a href="/tags" class="header__link">Tags</a>
			
				<a href="/atom.xml" class="header__link">RSS</a>
			
		</nav>
		<h1 class="header__title"><a href="/">失落的乐章</a></h1>
		<h2 class="header__subtitle">技术面前，永远都是学生。</h2>
	</header>

	<main>
		<article>
	
		<h1>Mysql-5.5+Heartbeat-3.0.5+DRBD</h1>
	
	<div class="article__infos">
		<span class="article__date">2017-10-12</span><br />
		
		
			<span class="article__tags">
			  	<a class="article__tag-link" href="/tags/HA集群/">HA集群</a>
			</span>
		
	</div>

	

	
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;环境：</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;CentOS 6.5</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MySQL_Master  </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;eth0  192.168.1.10</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;eth1  192.168.2.10        </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MySQL_Slave    </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;eth0  192.168.1.11</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;eth1  192.168.2.11</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;HA    192.168.1.254</p>
<h2 id="创建RAID1-0组合-存储数据-四块硬盘"><a href="#创建RAID1-0组合-存储数据-四块硬盘" class="headerlink" title="创建RAID1+0组合[存储数据 四块硬盘]"></a>创建RAID1+0组合[存储数据 四块硬盘]</h2><h3 id="1-创建两块RAID1-4块硬盘、MySQL主从节点执行"><a href="#1-创建两块RAID1-4块硬盘、MySQL主从节点执行" class="headerlink" title="1.创建两块RAID1 [4块硬盘、MySQL主从节点执行]"></a>1.创建两块RAID1 [4块硬盘、MySQL主从节点执行]</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div></pre></td><td class="code"><pre><div class="line">[root@master ~]<span class="comment"># mdadm --create /dev/md0 --level=raid1 --raid-devices=2 /dev/sdb1 /dev/sdc1</span></div><div class="line">mdadm: Note: this array has metadata at the start and</div><div class="line"> may not be suitable as a boot device. If you plan to</div><div class="line"> store <span class="string">'/boot'</span> on this device please ensure that</div><div class="line"> your boot-loader understands md/v1.x metadata, or use</div><div class="line"> --metadata=0.90</div><div class="line">Continue creating array? y</div><div class="line">mdadm: Defaulting to version 1.2 metadata</div><div class="line">mdadm: array /dev/md0 started.</div><div class="line">[root@master ~]<span class="comment"># mdadm --create /dev/md1 --level=raid1 --raid-devices=2 /dev/sdb1 /dev/sdc1</span></div><div class="line">mdadm: Note: this array has metadata at the start and</div><div class="line"> may not be suitable as a boot device. If you plan to</div><div class="line"> store <span class="string">'/boot'</span> on this device please ensure that</div><div class="line"> your boot-loader understands md/v1.x metadata, or use</div><div class="line"> --metadata=0.90</div><div class="line">Continue creating array? y</div><div class="line">mdadm: Defaulting to version 1.2 metadata</div><div class="line">mdadm: array /dev/md1 started.</div></pre></td></tr></table></figure>
<h3 id="2-利用两个-RAID1-创建-RAID0"><a href="#2-利用两个-RAID1-创建-RAID0" class="headerlink" title="2.利用两个 RAID1 创建 RAID0"></a>2.利用两个 RAID1 创建 RAID0</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@CentOS ~]<span class="comment"># mdadm --create /dev/md2 --level=raid0 --raid-devices=2 /dev/md0 /dev/md1</span></div><div class="line">mdadm: Defaulting to version 1.2 metadata</div><div class="line">mdadm: array /dev/md2 started.</div></pre></td></tr></table></figure>
<h3 id="3-将raid信息写入配置文件"><a href="#3-将raid信息写入配置文件" class="headerlink" title="3.将raid信息写入配置文件"></a>3.将raid信息写入配置文件</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">[root@master ~]<span class="comment"># mdadm --detail --scan &gt; /etc/mdadm.conf </span></div><div class="line">[root@master ~]<span class="comment"># vi /etc/mdadm.conf</span></div><div class="line">ARRAY /dev/md0 metadata=1.2 name=CentOS:0 UUID=b4c4c7b4:0f9f6e60:7eb24578:29682c96</div><div class="line">devices /dev/sdb1 /dev/sdc1</div><div class="line">ARRAY /dev/md1 metadata=1.2 name=CentOS:1 UUID=f5afcda6:86847677:c752fcdd:fbb91e00</div><div class="line">devices /dev/sdd1 /dev/sde1</div><div class="line">ARRAY /dev/md2 metadata=1.2 name=CentOS:2 UUID=00f120ec:bab2f3fe:80d88cb9:3ee4b76b</div><div class="line">devices /dev/md0 /dev/md1</div></pre></td></tr></table></figure>
<h2 id="安装DRBD"><a href="#安装DRBD" class="headerlink" title="安装DRBD"></a>安装DRBD</h2><h3 id="1-解压并安装DRBD"><a href="#1-解压并安装DRBD" class="headerlink" title="1.解压并安装DRBD"></a>1.解压并安装DRBD</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">[root@master Linux]<span class="comment"># yum -y install gcc kernel-devel kernel-headers flex perl</span></div><div class="line">[root@master Linux]<span class="comment"># http://oss.linbit.com/drbd/8.4/drbd-8.4.4.tar.gz</span></div><div class="line">[root@master Linux]<span class="comment"># tar fzvx drbd-8.4.4.tar.gz</span></div><div class="line">[root@master Linux]<span class="comment"># cd drbd-8.4.4</span></div><div class="line">[root@master drbd-8.4.4]<span class="comment"># ./configure --prefix=/usr/local/drbd-8.4 --with-km</span></div><div class="line">[root@master drbd-8.4.4]<span class="comment"># make KDIR=/usr/src/kernels/2.6.32-358.el6.x86_64/</span></div><div class="line">[root@master drbd-8.4.4]<span class="comment"># make install</span></div><div class="line">[root@master drbd-8.4.4<span class="comment"># mkdir -p /usr/local/drbd-8.4/var/run/drbd</span></div><div class="line">[root@master drbd-8.4.4]<span class="comment"># cp /usr/local/drbd-8.4/etc/rc.d/init.d/drbd /etc/init.d/</span></div><div class="line">[root@master drbd-8.4.4]<span class="comment"># chkconfig --add drbd</span></div><div class="line">[root@master drbd-8.4.4]<span class="comment"># chkconfig drbd on</span></div></pre></td></tr></table></figure>
<h3 id="2-安装drbd模块"><a href="#2-安装drbd模块" class="headerlink" title="2.安装drbd模块"></a>2.安装drbd模块</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">[root@master drbd-8.4.4]<span class="comment"># cd drbd</span></div><div class="line">[root@master drbd]<span class="comment"># make clean</span></div><div class="line">[root@master drbd]<span class="comment"># make KDIR=/usr/src/kernels/2.6.32-358.el6.x86_64/</span></div><div class="line">[root@master drbd]<span class="comment"># cp drbd.ko /lib/modules/2.6.32-358.el6.x86_64/kernel/lib/</span></div><div class="line">[root@master drbd]<span class="comment"># depmod</span></div></pre></td></tr></table></figure>
<h3 id="3-配置global-common-conf"><a href="#3-配置global-common-conf" class="headerlink" title="3.配置global_common.conf"></a>3.配置global_common.conf</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div></pre></td><td class="code"><pre><div class="line">[root@master drbd]<span class="comment"># cd /usr/local/drbd-8.4/etc/drbd.d/</span></div><div class="line">[root@master drbd.d]<span class="comment"># cp global_common.conf global_common.conf.bak</span></div><div class="line">[root@master drbd.d]<span class="comment"># vi global_common.conf</span></div><div class="line">global &#123;</div><div class="line">usage-count no;</div><div class="line">&#125;</div><div class="line">common &#123;</div><div class="line">handlers &#123;</div><div class="line">pri-on-incon-degr <span class="string">"/usr/lib/drbd/notify-pri-on-incon-degr.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b &gt; /proc/sysrq-trigger ; reboot -f"</span>;</div><div class="line">pri-lost-after-sb <span class="string">"/usr/lib/drbd/notify-pri-lost-after-sb.sh; /usr/lib/drbd/notify-emergency-reboot.sh; echo b &gt; /proc/sysrq-trigger ; reboot -f"</span>;</div><div class="line"><span class="built_in">local</span>-io-error <span class="string">"/usr/lib/drbd/notify-io-error.sh; /usr/lib/drbd/notify-emergency-shutdown.sh; echo o &gt; /proc/sysrq-trigger ; halt -f"</span>;</div><div class="line">fence-peer <span class="string">"/usr/lib/drbd/crm-fence-peer.sh"</span>;</div><div class="line">split-brain <span class="string">"/usr/lib/drbd/notify-split-brain.sh root"</span>;</div><div class="line">out-of-sync <span class="string">"/usr/lib/drbd/notify-out-of-sync.sh root"</span>;</div><div class="line">&#125;</div><div class="line">startup &#123;</div><div class="line">wfc-timeout 30;</div><div class="line">degr-wfc-timeout 30;</div><div class="line">outdated-wfc-timeout 30;</div><div class="line">&#125;</div><div class="line">disk &#123;</div><div class="line"><span class="comment">#磁盘读写速度与同步速率的30%</span></div><div class="line">resync-rate 30M;</div><div class="line">on-io-error detach;</div><div class="line">fencing resource-only;</div><div class="line">&#125;</div><div class="line">net &#123;</div><div class="line">protocol C;</div><div class="line">cram-hmac-alg sha1;</div><div class="line">shared-secret <span class="string">"mysql-ha"</span>;</div><div class="line">csums-alg sha1;</div><div class="line">verify-alg crc32c;</div><div class="line">&#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h3 id="4-创建r0资源"><a href="#4-创建r0资源" class="headerlink" title="4.创建r0资源"></a>4.创建r0资源</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line">[root@master drbd.d]<span class="comment"># vi r0.res</span></div><div class="line">resource r0&#123;</div><div class="line"> on master&#123;</div><div class="line"> device /dev/drbd0; <span class="comment">#逻辑设备的路径</span></div><div class="line"> disk /dev/md2; <span class="comment">#物理设备</span></div><div class="line"> address  192.168.2.10:7788;</div><div class="line"> meta-disk  internal;</div><div class="line"> &#125;</div><div class="line"> on slave&#123;</div><div class="line"> device /dev/drbd0;</div><div class="line"> disk /dev/md2;</div><div class="line"> address  192.168.2.11:7788;</div><div class="line"> meta-disk  internal;</div><div class="line"> &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h3 id="5-建立-drbd-resource"><a href="#5-建立-drbd-resource" class="headerlink" title="5.建立 drbd resource"></a>5.建立 drbd resource</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@master drbd.d]<span class="comment"># modprobe drbd</span></div><div class="line">[root@master drbd.d]<span class="comment"># drbdadm create-md r0</span></div><div class="line">[root@master drbd.d]<span class="comment"># drbdadm up r0</span></div></pre></td></tr></table></figure>
<h3 id="6-设置Primary-在master节点操作"><a href="#6-设置Primary-在master节点操作" class="headerlink" title="6.设置Primary [在master节点操作]"></a>6.设置Primary [在master节点操作]</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@master drbd.d]<span class="comment"># drbdadm primary --force r0</span></div></pre></td></tr></table></figure>
<h3 id="7-创建DRBD文件系统-在Mysql主节点的master上执行"><a href="#7-创建DRBD文件系统-在Mysql主节点的master上执行" class="headerlink" title="7.创建DRBD文件系统 [在Mysql主节点的master上执行]"></a>7.创建DRBD文件系统 [在Mysql主节点的master上执行]</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@master drbd.d]<span class="comment"># mkfs.ext4 /dev/drbd0</span></div><div class="line">[root@master drbd.d]<span class="comment"># mount /dev/drbd0 /raid10/</span></div></pre></td></tr></table></figure>
<h3 id="8-DRBD同步测试"><a href="#8-DRBD同步测试" class="headerlink" title="8.DRBD同步测试"></a>8.DRBD同步测试</h3><h4 id="首先，在主服务器上先将设备卸载，同时将主服务器降为备用服务器："><a href="#首先，在主服务器上先将设备卸载，同时将主服务器降为备用服务器：" class="headerlink" title="首先，在主服务器上先将设备卸载，同时将主服务器降为备用服务器："></a>首先，在主服务器上先将设备卸载，同时将主服务器降为备用服务器：</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[root@master drbd]<span class="comment"># mkdir -p /raid10/mysql/data</span></div><div class="line">[root@master drbd]<span class="comment"># cd /</span></div><div class="line">[root@master /]<span class="comment"># umount /dev/drbd0</span></div><div class="line">[root@master /]<span class="comment"># drbdadm secondary r0</span></div></pre></td></tr></table></figure>
<h4 id="然后，登录备用服务器，将备用服务器升为主服务器，同时挂载drbd0设备到-raid10目录："><a href="#然后，登录备用服务器，将备用服务器升为主服务器，同时挂载drbd0设备到-raid10目录：" class="headerlink" title="然后，登录备用服务器，将备用服务器升为主服务器，同时挂载drbd0设备到 /raid10目录："></a>然后，登录备用服务器，将备用服务器升为主服务器，同时挂载drbd0设备到 /raid10目录：</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">[root@slave drbd]<span class="comment"># drbdadm up r0</span></div><div class="line">[root@slave drbd]<span class="comment"># drbdadm primary r0</span></div><div class="line">[root@slave drbd]<span class="comment"># mount /dev/drbd0 /raid10/</span></div><div class="line">[root@slave drbd]<span class="comment"># cd /raid10/</span></div><div class="line">[root@slave raid10]<span class="comment"># ls</span></div><div class="line">lost+found mysql</div></pre></td></tr></table></figure>
<h2 id="使用中出现脑裂以及解决办法"><a href="#使用中出现脑裂以及解决办法" class="headerlink" title="使用中出现脑裂以及解决办法"></a>使用中出现脑裂以及解决办法</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[root@slave ~]<span class="comment"># cat /proc/drbd</span></div><div class="line">version: 8.4.4 (api:1/proto:86-101)</div><div class="line">GIT-hash: 599f286440bd633d15d5ff985204aff4bccffadd build by root@slave, 2013-12-03 09:50:30 0: cs:StandAlone ro:Primary/Unknown ds:UpToDate/Outdated r-----</div><div class="line">ns:0 nr:0 dw:2 dr:1684 al:1 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:4</div></pre></td></tr></table></figure>
<h3 id="查看日志"><a href="#查看日志" class="headerlink" title="查看日志"></a>查看日志</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">[root@slave /]<span class="comment"># tail -f /var/log/messages</span></div><div class="line">Dec  3 11:06:05 slave kernel: block drbd0: helper <span class="built_in">command</span>: /sbin/drbdadm split-brain minor-0 <span class="built_in">exit</span> code</div><div class="line">127 (0x7f00)</div><div class="line">Dec  3 11:06:05 slave kernel: drbd r0: conn( WFReportParams -&gt; Disconnecting )</div><div class="line">Dec  3 11:06:05 slave kernel: drbd r0: error receiving ReportState, e: -5 l: 0!</div><div class="line">Dec  3 11:06:05 slave kernel: drbd r0: asender terminated</div><div class="line">Dec  3 11:06:05 slave kernel: drbd r0: Terminating drbd_a_r0</div><div class="line">Dec  3 11:06:05 slave kernel: drbd r0: Connection closed</div><div class="line">Dec  3 11:06:05 slave kernel: drbd r0: conn( Disconnecting -&gt; StandAlone )</div><div class="line">Dec  3 11:06:05 slave kernel: drbd r0: receiver terminated</div><div class="line">Dec  3 11:06:05 slave kernel: drbd r0: Terminating drbd_r_r0</div><div class="line">Dec  3 11:06:41 slave kernel: block drbd0: role( Secondary -&gt; Primary )</div></pre></td></tr></table></figure>
<h2 id="解决方法："><a href="#解决方法：" class="headerlink" title="解决方法："></a>解决方法：</h2><h3 id="1-需要将现在的master角色修改为secondary"><a href="#1-需要将现在的master角色修改为secondary" class="headerlink" title="1.需要将现在的master角色修改为secondary"></a>1.需要将现在的master角色修改为secondary</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@master ~]<span class="comment"># drbdadm secondary r0</span></div><div class="line"><span class="comment">#该命令告诉slave，secondary上的数据不正确，以primary上的数据为准。</span></div><div class="line">[root@master ~]<span class="comment"># drbdadm -- --discard-my-data connect r0</span></div></pre></td></tr></table></figure>
<h3 id="2-我们还需要在slave上执行下面操作"><a href="#2-我们还需要在slave上执行下面操作" class="headerlink" title="2.我们还需要在slave上执行下面操作"></a>2.我们还需要在slave上执行下面操作</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line"><span class="comment">#这样master就能和slave开始连接上了，并且保证数据不会丢失：</span></div><div class="line">[root@slave ~]<span class="comment"># drbdadm connect r0</span></div><div class="line">[root@slave ~]<span class="comment"># cat /proc/drbd</span></div><div class="line">version: 8.4.4 (api:1/proto:86-101)</div><div class="line">GIT-hash: 599f286440bd633d15d5ff985204aff4bccffadd build by root@slave, 2013-12-03 09:50:30</div><div class="line"> 0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----</div><div class="line"> ns:0 nr:4 dw:6 dr:1688 al:1 bm:1 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0</div><div class="line">[root@master ~]<span class="comment"># cat /proc/drbd</span></div><div class="line">version: 8.4.4 (api:1/proto:86-101)</div><div class="line">GIT-hash: 599f286440bd633d15d5ff985204aff4bccffadd build by root@master, 2013-12-03 09:49:22</div><div class="line"> 0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----</div><div class="line"> ns:4 nr:0 dw:1 dr:1015 al:1 bm:1 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0</div></pre></td></tr></table></figure>
<h2 id="安装mysql"><a href="#安装mysql" class="headerlink" title="安装mysql"></a>安装mysql</h2><h3 id="1-mastr节点"><a href="#1-mastr节点" class="headerlink" title="1.mastr节点"></a>1.mastr节点</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div></pre></td><td class="code"><pre><div class="line">[root@master Linux]<span class="comment"># yum install gcc gcc-c++ autoconf automake ncurses-devel libtool-ltdl-devel* -y</span></div><div class="line">[root@master Linux]<span class="comment"># useradd -M -s /sbin/nologin mysql</span></div><div class="line">[root@master Linux]<span class="comment"># tar zfvx cmake-2.8.12.tar.gz</span></div><div class="line">[root@master Linux]<span class="comment"># cd cmake-2.8.12</span></div><div class="line">[root@master cmake-2.8.12]<span class="comment"># ./configure</span></div><div class="line">[root@master cmake-2.8.12]<span class="comment"># gmake &amp;&amp; make install</span></div><div class="line">[root@master cmake-2.8.12]<span class="comment"># cd ..</span></div><div class="line">[root@master Linux]<span class="comment"># tar zfxv mysql-5.5.25.tar.gz</span></div><div class="line">[root@master Linux]<span class="comment"># cd mysql-5.5.25</span></div><div class="line">[root@master mysql-5.5.25]<span class="comment"># cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5</span></div><div class="line">[root@master mysql-5.5.25]<span class="comment"># make &amp;&amp; make install</span></div><div class="line">[root@master mysql-5.5.25]<span class="comment"># cp support-files/my-medium.cnf /raid10/mysql/my.cf</span></div><div class="line">[root@master mysql-5.5.25]<span class="comment"># rm -rf /etc/my.cnf</span></div><div class="line">[root@master mysql-5.5.25]<span class="comment"># ln -sv /raid10/mysql/my.cf /etc/</span></div><div class="line">[root@master mysql-5.5.25]<span class="comment"># cd /usr/local/mysql-5.5/</span></div><div class="line">[root@master mysql-5.5]<span class="comment"># chown -R root:mysql .</span></div><div class="line">[root@master mysql-5.5]<span class="comment"># chown -R mysql:mysql /raid10/mysql/data/</span></div><div class="line">[root@master mysql-5.5]<span class="comment"># ./scripts/mysql_install_db --user=mysql \</span></div><div class="line">--basedir=/usr/<span class="built_in">local</span>/mysql-5.5/ \</div><div class="line">--datadir=/raid10/mysql/data/</div><div class="line">[root@master mysql-5.5]<span class="comment"># cp support-files/mysql.server /etc/init.d/mysqld</span></div><div class="line">[root@master mysql-5.5]<span class="comment"># chmod +x /etc/init.d/mysqld</span></div><div class="line">[root@master mysql-5.5]<span class="comment"># chkconfig --add mysqld</span></div><div class="line">[root@master mysql-5.5]<span class="comment"># vi /etc/init.d/mysqld</span></div><div class="line">datadir=/raid10/mysql/data</div></pre></td></tr></table></figure>
<h3 id="2-savle节点安装"><a href="#2-savle节点安装" class="headerlink" title="2.savle节点安装"></a>2.savle节点安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line">——安装mysql[MySQL主节点的savle节点安装]</div><div class="line">[root@slave Linux]<span class="comment"># yum install gcc gcc-c++ autoconf automake ncurses-devel libtool-ltdl-devel* -y</span></div><div class="line">[root@slaveLinux]<span class="comment"># useradd -M -s /sbin/nologin mysql</span></div><div class="line">[root@slave Linux]<span class="comment"># tar zfvx cmake-2.8.12.tar.gz</span></div><div class="line">[root@slave Linux]<span class="comment"># cd cmake-2.8.12</span></div><div class="line">[root@slavecmake-2.8.12]<span class="comment"># ./configure</span></div><div class="line">[root@slavecmake-2.8.12]<span class="comment"># gmake &amp;&amp; make install</span></div><div class="line">[root@slavecmake-2.8.12]<span class="comment"># cd ..</span></div><div class="line">[root@slave Linux]<span class="comment"># tar zfxv mysql-5.5.25.tar.gz</span></div><div class="line">[root@slave Linux]<span class="comment"># cd mysql-5.5.25</span></div><div class="line">[root@slave mysql-5.5.25]<span class="comment"># cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5</span></div><div class="line">[root@slave mysql-5.5.25]<span class="comment"># make &amp;&amp; make install</span></div><div class="line">[root@slave mysql-5.5.25]<span class="comment"># cd /usr/local/mysql-5.5/</span></div><div class="line">[root@slave mysql-5.5]<span class="comment"># chown -R root:mysql .</span></div><div class="line">[root@slave mysql-5.5]<span class="comment"># cp support-files/mysql.server /etc/init.d/mysqld</span></div><div class="line">[root@slave mysql-5.5]<span class="comment"># vi /etc/init.d/mysqld</span></div><div class="line">datadir=/raid10/mysql/data</div></pre></td></tr></table></figure>
<h2 id="MySQL主节点实现高可用"><a href="#MySQL主节点实现高可用" class="headerlink" title="MySQL主节点实现高可用"></a>MySQL主节点实现高可用</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;注意：以下操作在MySQL主节点的master、slave节点执行</p>
<h3 id="1-添加hosts主机信息"><a href="#1-添加hosts主机信息" class="headerlink" title="1.添加hosts主机信息"></a>1.添加hosts主机信息</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@master Linux]<span class="comment"># vi /etc/hosts</span></div><div class="line">192.168.2.10  master</div><div class="line">192.168.2.11  slave</div></pre></td></tr></table></figure>
<h3 id="2-添加用户和组"><a href="#2-添加用户和组" class="headerlink" title="2.添加用户和组"></a>2.添加用户和组</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@master Linux]<span class="comment"># groupadd haclient</span></div><div class="line">[root@master Linux]<span class="comment"># useradd -g haclient -M -s /sbin/nologin hacluster</span></div></pre></td></tr></table></figure>
<h3 id="3-安装heartbeat"><a href="#3-安装heartbeat" class="headerlink" title="3.安装heartbeat"></a>3.安装heartbeat</h3><h4 id="安装相关软件依赖包"><a href="#安装相关软件依赖包" class="headerlink" title="安装相关软件依赖包"></a>安装相关软件依赖包</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">[root@master Linux]<span class="comment"># yum install libtool automake autoconf \</span></div><div class="line">glib2-devel \</div><div class="line">libxml2-devel \</div><div class="line">bzip2-devel \</div><div class="line">libtool-ltdl-devel \</div><div class="line">libxslt-devel \</div><div class="line">docbook* -y</div></pre></td></tr></table></figure>
<h4 id="安装glue"><a href="#安装glue" class="headerlink" title="安装glue"></a>安装glue</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">[root@master Linux]<span class="comment"># wget http://hg.linux-ha.org/glue/archive/glue-1.0.9.tar.bz2</span></div><div class="line">[root@master Linux]<span class="comment"># tar jfvx glue-1.0.9.tar.bz2</span></div><div class="line">[root@master Linux]<span class="comment"># cd Reusable-Cluster-Components-glue--glue-1.0.9/</span></div><div class="line">[root@master Reusable-Cluster-Components-glue--glue-1.0.9]<span class="comment"># ./autogen.sh</span></div><div class="line">[root@master Reusable-Cluster-Components-glue--glue-1.0.9]<span class="comment"># ./configure LIBS='/lib64/libuuid.so.1'</span></div><div class="line">[root@CentOS Reusable-Cluster-Components-glue--glue-1.0.9]<span class="comment"># make &amp;&amp; make install</span></div></pre></td></tr></table></figure>
<h4 id="安装agents"><a href="#安装agents" class="headerlink" title="安装agents"></a>安装agents</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">[root@master Heartbeat-3-0-7e3a82377fa8]<span class="comment"># cd ..</span></div><div class="line">[root@master Linux]<span class="comment"># wget https://codeload.github.com/ClusterLabs/resource-agents/legacy.tar.gz/v3.9.2</span></div><div class="line">[root@master Linux]<span class="comment"># tar zfvx ClusterLabs-resource-agents-v3.9.2-0-ge261943.tar.gz</span></div><div class="line">[root@master Linux]<span class="comment"># cd ClusterLabs-resource-agents-b735277/</span></div><div class="line">[root@master ClusterLabs-resource-agents-b735277]<span class="comment"># ./autogen.sh</span></div><div class="line">[root@master ClusterLabs-resource-agents-b735277]<span class="comment"># ./configure LIBS='/lib64/libuuid.so.1'</span></div><div class="line">[root@master ClusterLabs-resource-agents-b735277]<span class="comment"># make &amp;&amp; make install</span></div></pre></td></tr></table></figure>
<h4 id="安装heartbeat"><a href="#安装heartbeat" class="headerlink" title="安装heartbeat"></a>安装heartbeat</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">[root@master ClusterLabs-resource-agents-b735277]<span class="comment"># cd ..</span></div><div class="line">[root@master Linux]<span class="comment"># wget http://hg.linux-ha.org/heartbeat-STABLE_3_0/archive/7e3a82377fa8.tar.bz2</span></div><div class="line">[root@master Linux]<span class="comment"># tar jfvx heartbeat-3.0.5.tar.bz2</span></div><div class="line">[root@master Linux]<span class="comment"># cd Heartbeat-3-0-7e3a82377fa8/</span></div><div class="line">[root@master Heartbeat-3-0-7e3a82377fa8]<span class="comment"># ./bootstrap</span></div><div class="line">[root@master Heartbeat-3-0-7e3a82377fa8]<span class="comment"># ./ConfigureMe configure LIBS='/lib64/libuuid.so.1'</span></div><div class="line">[root@master Heartbeat-3-0-7e3a82377fa8]<span class="comment"># make &amp;&amp; make install</span></div></pre></td></tr></table></figure>
<h3 id="4-配置heartbeat"><a href="#4-配置heartbeat" class="headerlink" title="4.配置heartbeat"></a>4.配置heartbeat</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div></pre></td><td class="code"><pre><div class="line">[root@master Heartbeat-3-0-7e3a82377fa8]<span class="comment"># cd doc</span></div><div class="line">[root@master doc]<span class="comment"># cp authkeys haresources ha.cf /etc/ha.d/</span></div><div class="line">[root@master doc]<span class="comment"># cp /usr/etc/ha.d/shellfuncs /etc/ha.d/</span></div><div class="line">[root@master doc]<span class="comment"># rm -rf /usr/etc/ha.d</span></div><div class="line">[root@master doc]<span class="comment"># ln -sv /etc/ha.d /usr/etc</span></div><div class="line">[root@master doc]<span class="comment"># vi /etc/ha.d/ha.cf</span></div><div class="line"><span class="comment">#开启日志</span></div><div class="line">logfile /var/<span class="built_in">log</span>/ha-log</div><div class="line"><span class="comment">#设置syslog()/logger设备</span></div><div class="line">logfacility local0</div><div class="line"><span class="comment">#心跳发送时间间隔/秒</span></div><div class="line">keepalive 2</div><div class="line"><span class="comment">#15秒没有收到主机心跳、确认主机故障</span></div><div class="line">deadtime 15</div><div class="line"><span class="comment">#警告次数</span></div><div class="line">warntime 5</div><div class="line"><span class="comment">#守护进程启动30后 启动服务资源</span></div><div class="line">initdead 30</div><div class="line"><span class="comment">#监听端口</span></div><div class="line">udpport 694</div><div class="line"><span class="comment">#另一个节点IP、通过检测来保证心跳的可用性</span></div><div class="line">ucast eth0 192.168.1.11</div><div class="line">ucast eth1 192.168.2.11</div><div class="line"><span class="comment">#两个节点的名字 [uname -n 获取]</span></div><div class="line">node master</div><div class="line">node slave</div><div class="line"><span class="comment">#开启DPOD</span></div><div class="line">respawn hacluster /usr/lib64/heartbeat/ipfail</div><div class="line">respawn hacluster /usr/lib64/heartbeat/dopd</div><div class="line">apiauth ipfail gid=haclient uid=hacluster</div><div class="line">apiauth dopd gid=haclient uid=hacluster</div><div class="line">[root@master doc]<span class="comment"># vi /etc/ha.d/authkeys</span></div><div class="line">auth 1</div><div class="line">1 sha1 HI!</div><div class="line">[root@master doc]<span class="comment"># chmod 600 /etc/ha.d/authkeys</span></div><div class="line">[root@master doc]<span class="comment"># vi /etc/ha.d/haresources</span></div><div class="line">master drbddisk::r0 Filesystem::/dev/drbd0::/raid10::ext4 mysqld IPaddr::192.168.1.254/24/eth0</div><div class="line">[root@master doc]<span class="comment"># cd /Linux/drbd-8.4.4/scripts/</span></div><div class="line">[root@master scripts]<span class="comment"># cp drbddisk /etc/ha.d/resource.d/</span></div><div class="line">[root@master scripts]<span class="comment"># cp /etc/init.d/mysqld /etc/ha.d/resource.d/</span></div><div class="line">[root@master scripts]<span class="comment"># chkconfig --add heartbeat</span></div><div class="line">[root@master scripts]<span class="comment"># chkconfig heartbeat on</span></div></pre></td></tr></table></figure>
<h2 id="测试"><a href="#测试" class="headerlink" title="测试"></a>测试</h2><h3 id="1-启动master节点启动heartbeat"><a href="#1-启动master节点启动heartbeat" class="headerlink" title="1.启动master节点启动heartbeat"></a>1.启动master节点启动heartbeat</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@master scripts]<span class="comment"># /etc/init.d/heartbeat start</span></div></pre></td></tr></table></figure>
<h3 id="2-启动slave节点启动heartbeat"><a href="#2-启动slave节点启动heartbeat" class="headerlink" title="2.启动slave节点启动heartbeat"></a>2.启动slave节点启动heartbeat</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@slave scripts]<span class="comment"># /etc/init.d/heartbeat start</span></div></pre></td></tr></table></figure>
<h2 id="3-在master节点上查看启动日志"><a href="#3-在master节点上查看启动日志" class="headerlink" title="3.在master节点上查看启动日志"></a>3.在master节点上查看启动日志</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">[root@master ha.d]<span class="comment"># tail -f /var/log/ha-log</span></div><div class="line">Apr 26 21:11:48 master heartbeat: [42033]: info: Starting child client <span class="string">"/usr/lib64/heartbeat/ipfail"</span> (501,501)</div><div class="line">Apr 26 21:11:48 master heartbeat: [42033]: info: Starting child client <span class="string">"/usr/lib64/heartbeat/dopd"</span> (501,501)</div><div class="line">Apr 26 21:11:48 mster heartbeat: [42062]: info: Starting <span class="string">"/usr/lib64/heartbeat/ipfail"</span> as uid 501  gid 501 (pid 42062)</div><div class="line">Apr 26 21:11:48 mster heartbeat: [42064]: info: Starting <span class="string">"/usr/lib64/heartbeat/dopd"</span> as uid 501  gid 501 (pid 42064)</div><div class="line">Apr 26 21:11:48 mster heartbeat: [42061]: info: Local Resource acquisition completed.</div><div class="line">Apr 26 21:11:48 mster heartbeat: [42033]: info: Initial resource acquisition complete (req_our_resources)</div><div class="line">Apr 26 21:11:48 mster ipfail: [42062]: ERROR: auto_failback <span class="built_in">set</span> to incompatible legacy option.</div><div class="line">Apr 26 21:11:48 mster heartbeat: [42033]: WARN: Managed /usr/lib64/heartbeat/ipfail process 42062 exited with <span class="built_in">return</span> code 100.</div><div class="line">Apr 26 21:11:48 mster heartbeat: [42033]: info: Status update <span class="keyword">for</span> slave: status active</div><div class="line">harc[42104]:  2014/04/26_21:11:48 info: Running /usr/etc/ha.d//rc.d/status status</div><div class="line"><span class="comment">#说明启动成功</span></div></pre></td></tr></table></figure>
<h3 id="4-切换主备"><a href="#4-切换主备" class="headerlink" title="4.切换主备"></a>4.切换主备</h3><h4 id="在master节点停掉heartbeat"><a href="#在master节点停掉heartbeat" class="headerlink" title="在master节点停掉heartbeat"></a>在master节点停掉heartbeat</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@master scripts]<span class="comment"># /etc/init.d/heartbeat stop</span></div></pre></td></tr></table></figure>
<h4 id="查看slave日志是否能自动切换至slave节点"><a href="#查看slave日志是否能自动切换至slave节点" class="headerlink" title="查看slave日志是否能自动切换至slave节点"></a>查看slave日志是否能自动切换至slave节点</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div></pre></td><td class="code"><pre><div class="line">[root@slave scripts]<span class="comment"># tail -f /var/log/ha-log</span></div><div class="line"><span class="comment">#显示master节点已经shutdown</span></div><div class="line">Apr 26 21:21:27 slave heartbeat: [42054]: info: Received shutdown notice from <span class="string">'master'</span>.</div><div class="line">Apr 26 21:21:27 slave heartbeat: [42054]: info: Resources being acquired from master.</div><div class="line">harc[42118]:  2014/04/26_21:21:27 info: Running /usr/etc/ha.d//rc.d/status status</div><div class="line">Apr 26 21:21:27 slave heartbeat: [42119]: info: No <span class="built_in">local</span> resources [/usr/share/heartbeat/ResourceManager listkeys slave] to acquire.</div><div class="line">mach_down[42148]:  2014/04/26_21:21:27 info: Taking over resource group drbddisk::r0</div><div class="line">ResourceManager[42175]: 2014/04/26_21:21:27 info: Acquiring resource group: master drbddisk::r0 Filesystem::/dev/drbd0::/raid10::ext4 mysqld IPaddr::192.168.1.254/24/eth0</div><div class="line">ResourceManager[42175]: 2014/04/26_21:21:27 info: Running /etc/ha.d/resource.d/drbddisk r0 start</div><div class="line">Filesystem[42239]:  2014/04/26_21:21:27 INFO: Resource is stopped</div><div class="line">ResourceManager[42175]: 2014/04/26_21:21:27 info: Running /etc/ha.d/resource.d/Filesystem /dev/drbd0 /raid10 ext4 start</div><div class="line">Filesystem[42320]:  2014/04/26_21:21:27 INFO: Running start <span class="keyword">for</span> /dev/drbd0 on /raid10</div><div class="line">Filesystem[42312]:  2014/04/26_21:21:28 INFO: Success</div><div class="line">ResourceManager[42175]: 2014/04/26_21:21:28 info: Running /etc/ha.d/resource.d/mysqld start</div><div class="line">Apr 26 21:21:39 slave heartbeat: [42054]: WARN: node master: is dead</div><div class="line">Apr 26 21:21:39 slave heartbeat: [42054]: info: Dead node master gave up resources.</div><div class="line">Apr 26 21:21:39 slave heartbeat: [42054]: info: Resources being acquired from master.</div><div class="line">Apr 26 21:21:39 slave heartbeat: [42054]: info: Link master:eth0 dead.</div><div class="line">Apr 26 21:21:39 slave heartbeat: [42054]: info: Link master:eth1 dead.</div><div class="line">Apr 26 21:21:41 slave heartbeat: [42614]: info: No <span class="built_in">local</span> resources [/usr/share/heartbeat/ResourceManager listkeys slave] to acquire.</div><div class="line">Apr 26 21:21:41 slave heartbeat: [42054]: info: Initial resource acquisition complete (req_our_resources)</div><div class="line">IPaddr[42642]:  2014/04/26_21:21:42 INFO: Resource is stopped</div><div class="line"><span class="comment">#显示slave节点的VIP已经运行</span></div><div class="line">ResourceManager[42175]: 2014/04/26_21:21:42 info: Running /etc/ha.d/resource.d/IPaddr 192.168.1.254/24/eth0 start</div><div class="line">IPaddr[42727]:  2014/04/26_21:21:42 INFO: Using calculated netmask <span class="keyword">for</span> 192.168.1.254: 255.255.255.0</div><div class="line">IPaddr[42727]:  2014/04/26_21:21:42 INFO: <span class="built_in">eval</span> ifconfig eth0:0 192.168.1.254 netmask 255.255.255.0 broadcast 192.168.1.255</div><div class="line">IPaddr[42701]:  2014/04/26_21:21:42 INFO: Success</div><div class="line">mach_down[42148]:  2014/04/26_21:21:42 info: mach_down takeover complete <span class="keyword">for</span> node master.</div><div class="line">harc[42820]:  2014/04/26_21:21:42 info: Running /usr/etc/ha.d//rc.d/status status</div><div class="line">mach_down[42837]:  2014/04/26_21:21:42 info: Taking over resource group drbddisk::r0</div><div class="line">ResourceManager[42864]: 2014/04/26_21:21:43 info: Acquiring resource group: master drbddisk::r0 Filesystem::/dev/drbd0::/raid10::ext4 mysqld IPaddr::192.168.1.254/24/eth0</div><div class="line"><span class="comment">#显示slave的mysql和drbd服务已经启动成功</span></div><div class="line">Filesystem[42906]:  2014/04/26_21:21:43 INFO: Running OK</div><div class="line">IPaddr[42987]:  2014/04/26_21:21:43 INFO: Running OK</div><div class="line">mach_down[42837]:  2014/04/26_21:21:43 info: mach_down takeover complete <span class="keyword">for</span> node master.</div></pre></td></tr></table></figure>

	

	
		<span class="different-posts"><a href="/2017/10/12/HA集群/5. Mysql-5.5+Heartbeat-3.0.5+DRBD/" onclick="window.history.go(-1); return false;">⬅️ Go back </a></span>

	

</article>

	</main>

	<footer class="footer">
	<div class="footer-content">
		
	      <div class="footer__element">
	<p>Hi there, <br />welcome to my Blog glad you found it. Have a look around, will you?</p>
</div>

	    
	      <div class="footer__element">
	<h5>Check out</h5>
	<ul class="footer-links">
		<li class="footer-links__link"><a href="/archives">Archive</a></li>
		
		  <li class="footer-links__link"><a href="/atom.xml">RSS</a></li>
	    
		<li class="footer-links__link"><a href="/about">about page</a></li>
		<li class="footer-links__link"><a href="/tags">Tags</a></li>
		<li class="footer-links__link"><a href="/categories">Categories</a></li>
	</ul>
</div>

	    

		<div class="footer-credit">
			<span>© 2017 失落的乐章 | Powered by <a href="https://hexo.io/">Hexo</a> | Theme <a href="https://github.com/HoverBaum/meilidu-hexo">MeiliDu</a></span>
		</div>

	</div>


</footer>



</body>

</html>
